//
//  HWMyWalletCellCell.m
//  嗨文
//
//  Created by 响当当 on 2019/2/21.
//  Copyright © 2019年 dongzheng. All rights reserved.
//

#import "HWMyWalletCellCell.h"

@interface HWMyWalletCellCell()
@property (nonatomic, strong)UILabel *titlelabel;//标题
@property (nonatomic, strong)UILabel *timeLabel;//时间
@property (nonatomic, strong)UILabel *moneyLabel;//金钱
@property (nonatomic, strong)UILabel *passLabel;//是否通过
@end

@implementation HWMyWalletCellCell

- (UILabel *)titlelabel
{
    if (!_titlelabel)
    {
        _titlelabel = [HWUtilties creatLabelWithFrame:CGRectMake(17*kUIScaleBasePlus,17*kUIScaleBasePlus,0,16*kUIScaleBasePlus)
                                         textAligment:NSTextAlignmentLeft
                                             textClor:LCHexColor(0x161616)
                                             textFont:16*kUIScaleBasePlus];
    }
    return _titlelabel;
}

- (UILabel *)passLabel
{
    if (!_passLabel)
    {
        _passLabel = [HWUtilties creatLabelWithFrame:CGRectMake(0,17*kUIScaleBasePlus,40*kUIScaleBasePlus,15*kUIScaleBasePlus)
                                         textAligment:NSTextAlignmentCenter
                                             textClor:LCHexColor(0xF54337)
                                             textFont:10*kUIScaleBasePlus];
        _passLabel.layer.masksToBounds = YES;
        _passLabel.layer.borderColor = LCHexColor(0xF54337).CGColor;
        _passLabel.layer.borderWidth = 1;
        _passLabel.layer.cornerRadius = 4;
    }
    return _passLabel;
}

- (UILabel *)timeLabel
{
    if (!_timeLabel)
    {
        _timeLabel = [HWUtilties creatLabelWithFrame:CGRectMake(17*kUIScaleBasePlus,43*kUIScaleBasePlus,0,10*kUIScaleBasePlus)
                                        textAligment:NSTextAlignmentLeft
                                            textClor:LCHexColor(0x878787)
                                            textFont:12*kUIScaleBasePlus];
    }
    return _timeLabel;
}

- (UILabel *)moneyLabel
{
    if (!_moneyLabel)
    {
        _moneyLabel = [HWUtilties creatLabelWithFrame:CGRectMake(0,29*kUIScaleBasePlus,0,14*kUIScaleBasePlus)
                                        textAligment:NSTextAlignmentLeft
                                            textClor:LCHexColor(0xF54337)
                                            textFont:18*kUIScaleBasePlus];
    }
    return _moneyLabel;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        [self.contentView addSubview:self.titlelabel];
        [self.contentView addSubview:self.passLabel];
        [self.contentView addSubview:self.timeLabel];
        [self.contentView addSubview:self.moneyLabel];

        
        UIView *lineView = [[UIView alloc]initWithFrame:CGRectMake(16*kUIScaleBasePlus,67*kUIScaleBasePlus,343*kUIScaleBasePlus,1*kUIScaleBasePlus)];
        lineView.backgroundColor = LCHexColor(0xEBE5E1);
        [self.contentView addSubview:lineView];
    }
    return self;
}

#pragma mark - 获取数据
//- (void)getDate:(NSDictionary *)dic segmentNum:(NSString *)num
//{
//    self.titlelabel.text = dic[@"title"];
//    [self.titlelabel sizeToFit];
//    
//    if ([num isEqualToString:@"2"])
//    {
//        self.passLabel.text = dic[@"title"];
//        [self.titlelabel sizeToFit];
//        [self.passLabel setX:CGRectGetMaxX(self.titlelabel.frame)+8*kUIScaleBasePlus];
//    }
//    else
//    {
//        self.passLabel.frame = CGRectZero;
//    }
//    
//    self.timeLabel.text = dic[@"time"];
//    [self.timeLabel sizeToFit];
//    
//    self.moneyLabel.text = dic[@"money"];
//    [self.moneyLabel sizeToFit];
//    [self.moneyLabel setX:SCREEN_WIDTH-17*kUIScaleBasePlus-self.moneyLabel.frame.size.width];
//}

//金币兑换记录
- (void)getGoldExChange:(HWGoldExChangeModel *)model
{
    self.titlelabel.text = model.exchangeNote;
    [self.titlelabel sizeToFit];
    
    self.passLabel.frame = CGRectZero;

    self.timeLabel.text = model.exchangeTime;
    [self.timeLabel sizeToFit];
    
    self.moneyLabel.text = [NSString stringWithFormat:@"-%@",model.goldCoin];
    self.moneyLabel.textColor = LCHexColor(0x279dc);
    [self.moneyLabel sizeToFit];
    [self.moneyLabel setX:SCREEN_WIDTH-17*kUIScaleBasePlus-self.moneyLabel.frame.size.width];
}

//金币获得记录
- (void)getGoldRecord:(HWGetGoldModel *)model
{
    self.titlelabel.text = model.completorName;
    [self.titlelabel sizeToFit];
    
    self.passLabel.frame = CGRectZero;
    
    self.timeLabel.text = model.completeTime;
    [self.timeLabel sizeToFit];
    
    self.moneyLabel.text = [NSString stringWithFormat:@"+%@",model.rewardNum];
    [self.moneyLabel sizeToFit];
    [self.moneyLabel setX:SCREEN_WIDTH-17*kUIScaleBasePlus-self.moneyLabel.frame.size.width];
}

//余额提现记录
- (void)getMoneyExChange:(HWMoneyExChangeModel *)model
{
    self.titlelabel.text = @"余额提现";
    [self.titlelabel sizeToFit];
    
    if ([model.withdrawStauts isEqualToString:@"2"])
    {
        self.passLabel.text = @"已发放";
        [self.passLabel setFrame:CGRectMake(CGRectGetMaxX(self.titlelabel.frame)+8*kUIScaleBasePlus,17*kUIScaleBasePlus,40*kUIScaleBasePlus,15*kUIScaleBasePlus)];
    }
    
    self.timeLabel.text = model.checkTime;
    [self.timeLabel sizeToFit];
    
    self.moneyLabel.text = [NSString stringWithFormat:@"-%@",model.withdrawAmount];
    self.moneyLabel.textColor = LCHexColor(0x279dc);
    [self.moneyLabel sizeToFit];
    [self.moneyLabel setX:SCREEN_WIDTH-17*kUIScaleBasePlus-self.moneyLabel.frame.size.width];
}
@end
